<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>jsTree v.1.0 - Demo</title>
	<script type="text/javascript" src="../_lib/jquery.js"></script>
	<script type="text/javascript" src="../_lib/jquery.cookie.js"></script>
	<script type="text/javascript" src="../_lib/jquery.hotkeys.js"></script>
	<script type="text/javascript" src="../jquery.jstree.js"></script>
	<link type="text/css" rel="stylesheet" href="../_docs/syntax/!style.css"/>
	<link type="text/css" rel="stylesheet" href="../_docs/!style.css"/>
	<script type="text/javascript" src="../_docs/syntax/!script.js"></script>
</head>
<body id="demo_body">
<div id="container">

<h1 id="dhead">jsTree v.1.0</h1>
<h1>DEMO</h1>
<h2>Creating a tree, binding events, using the instance</h2>

<div id="demo1" class="demo" style="height:100px;">

</div>

<script type="text/javascript">

justATest();

function justATest(){
alert('in');
jQuery.getJSON("/nodes.json", {}, function (data) {alert(data)});
}



$(function () {
	$("#demo1").jstree({ 
		"json_data" : {
			"data" : [
				{ 
					"data" : "A node", 
					"metadata" : { id : 235 },
					"children" : [ "Child 1", "A Child 2" ]
				},
				{ 
					"attr" : { "id" : "li.node.id1" }, 
					"data" : { 
						"title" : "Long format demo", 
						"attr" : { "href" : "#" } 
					} 
				}
			]
		},
		"plugins" : [ "themes", "ui", "crrm", "contextmenu" ,"json_data", "contextmenu" ]
	}).bind("select_node.jstree", function (e, data) { alert(jQuery.data(data.rslt.obj[0], "id")); });
});


function add_node_here(selected_node){
//alert('add node here code' + selected_node);
$("#demo1").jstree("create",-1,false,"naya folder",function(obj){alert('callback' + obj.html);},true);
//this.create_node;
}



function add_node_inside(selected_node){
alert('add node inside code' + selected_node);
$("#demo1").jstree("create","inside",false,"naya baccha folder",function(obj){alert('callback' + obj.html);},true);
}

  
</script>

</body>
</html>